package jtk.project4.fleet.ibatis.dao;

import java.sql.SQLException;
import java.util.List;

import nl.coderight.jazz.dialog.MessageDialog;
import nl.coderight.jazz.dialog.MessageType;
import jtk.project4.fleet.domain.Objects;




public class ObjectsDao extends IbatisDao{
	
	public List selectObjects() throws SQLException {
		List selectObjects = null;
			selectObjects =getSqlMap().queryForList("SELECT_ALL_OBJECT", null);
		return selectObjects;
	}

	public int deleteObject(Objects objects) throws SQLException{
		return (int) getSqlMap().delete("DELETE_OBJECT", objects);
	}
	
	public int updateObject(Objects objects) throws SQLException{
		return (int) getSqlMap().update("UPDATE_OBJECT", objects);
	}
	
	public Object insertObject(Objects objects) throws SQLException{
		return (Object) getSqlMap().insert("INSERT_OBJECT", objects);
	}


		
	public static void main (String args[]) throws SQLException{
		Objects object;
		object = new Objects();
		//object.setObjectId(155);
		new ObjectsDao().insertObject(object);
		
		List l= new ObjectsDao().selectObjects();
		System.out.println(((Objects)l.get(1)).getCreateId());
		//Ngetes Delete
		new ObjectsDao().deleteObject((Objects)l.get(0));
		}
	
}